const minCostClimbingStairs = cost => {
  const n = cost.length
  let dp = []
  dp[0] = cost[0]
  dp[1] = cost[1]

  for (let i = 2; i < n; i++) {
    dp[i] = Math.min(dp[i - 1], dp[i - 2]) + cost[i]
  }
  console.log(dp);
  return Math.min(dp[n - 1], dp[n - 2])
}

console.log(minCostClimbingStairs([1, 100, 1, 1, 1, 100, 1, 1, 100, 1]));